﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using DevDL.UserLimit.IDAL;
using System.Reflection;

namespace DevDL.UserLimit.DALFactory
{
    public class DataAccess
    {
        private static string path = ConfigurationManager.AppSettings["OfficeDB"];

        public static IUserInfoDAL CreateUserInfoDAL()
        {
            string className = path + ".UserInfoDAL";
            return (IUserInfoDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IRoleDAL CreateRoleDAL()
        {
            string className = path + ".RoleDAL";
            return (IRoleDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IFunctionDAL CreateFunctionDAL()
        {
            string className = path + ".FunctionDAL";
            return (IFunctionDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IOperatorDAL CreateOperatorDAL()
        {
            string className = path + ".OperatorDAL";
            return (IOperatorDAL)Assembly.Load(path).CreateInstance(className);
        }
    }
}
